1.7 Binary Codes
Digital systems operate
using binary code, a system of 1s and 0s. However, humans interact with information
using decimal numbers. To bridge this gap, digital devices must convert data
between binary and a more human-readable format. This involves representing
each character (number, letter, or symbol) as a unique combination of 1s and
0s. This representation is called a code.
Part 1.7.1 Binary Coded Decimals (BCD) Codes
Arithmetic operations are
typically performed using decimal numbers. However, computers work with binary
numbers. Binary Coded Decimal (BCD) was developed to bridge this gap. BCD
represents each decimal digit as a four-bit binary equivalent. Numbers 0 to 9
correspond to binary codes 0000 to 1001. Six combinations (1010 to 1111) remain
unused. BCD codes are categorized into weighted and unweighted types.
Example
No. 1
Convert 936 to BCD Code
Solution:
|
3rd Digit |
2nd Digit |
1st Digit |
|
9 |
3 |
6 |
Answer |
1001 |
0011 |
0110 |
Example
No. 2
Convert 7121 to BCD Code
Solution:
|
4th Digit |
3rd Digit |
2nd Digit |
1st Digit |
|
7 |
1 |
2 |
1 |
Answer |
0111 |
0001 |
0010 |
0001 |
Part 1.7.2 Weighted BCD Code
The most common weighted BCD code is the 8-4-2-1 code. In this
code, the digits in a binary number have weights of 8, 4, 2, and 1. The table
below shows several weighted BCD codes.
Decimal
Digit |
Natural
Binary 8-4-2-1 |
4-2-2-1 |
2-4-2-1 |
Biquianary |
|
||||
5-0 |
4-3-2-1-0 |
|
|||||||
0 |
0000 |
0000 |
0000 |
01 |
00001 |
||||
1 |
0001 |
0001 |
0001 |
01 |
00010 |
||||
2 |
0010 |
0010 |
0010 |
01 |
00100 |
||||
3 |
0011 |
0011 |
0110 |
01 |
01000 |
||||
4 |
0100 |
1000 |
0100 |
01 |
10000 |
||||
5 |
0101 |
0111 |
1011 |
01 |
00001 |
||||
6 |
0110 |
1100 |
1100 |
10 |
00010 |
||||
7 |
0111 |
1101 |
1101 |
10 |
00100 |
||||
8 |
1000 |
1110 |
1110 |
10 |
01000 |
||||
9 |
1001 |
1111 |
1111 |
10 |
10000 |
||||
Part 1.7.3 Unweighted BCD Code
Unweighted BCD codes are used in data processing, transmission,
and measurement, but not in arithmetic operations due to their lack of
positional weight. Examples include Excess-3 code, Gray
code, and 2 out of 5 code. The table below shows these
codes.
Decimal Digit |
Excess-3 Code |
Gray Code |
2 out of 5 |
0 |
0011 |
0000 |
00011 |
1 |
0100 |
0001 |
00101 |
2 |
0101 |
0011 |
00110 |
3 |
0110 |
0010 |
01001 |
4 |
0111 |
0110 |
01010 |
5 |
1000 |
0111 |
01100 |
6 |
1001 |
0101 |
10001 |
7 |
1010 |
0100 |
10010 |
8 |
1011 |
1100 |
10100 |
9 |
1100 |
1101 |
1100 |
Note:
Excess-3 code is always three greater than the same 8-4-2-1 representation.
Part 1.7.4 Character Codes
In addition to numbers, digital systems must handle text, symbols,
and other non-numeric information. To do this, they use character codes that
represent letters, punctuation marks, and special characters.
EBCDIC:
An 8-bit code used in IBM systems. It represents characters using two 4-bit
groups.
ASCII:
The most common character code. It's a 7-bit code divided into data link
control, graphic control, and alphanumeric characters. Used for data transfer
between computers and devices.
Baudot
Code: A 5-level code developed for teletype machines. Represents
letters, numbers, punctuation, and special symbols using a
"lowercase" and "uppercase" set.
Hollerith
Code: Used in punched cards. Each column represents a digit,
letter, or symbol. A 12-level code is used to represent data.
Part 1.7.5 Codes for Actions, Conditions, and States
These
codes use simple binary numbers to control actions, indicate conditions, or
represent the current state of hardware in a digital system.
Part 1.7.6 Codes for Detecting and Correcting Errors
When
transmitting binary data, errors can occur, leading to misinterpretation. To
address this, digital systems use error detection and correction methods.
Parity bits, checksum codes, CRC codes, and Hamming codes are examples of these
techniques.
Part 1.7.7 Codes for Data Transmission
Data
transmission is a common operation in digital systems. Information is
transmitted in binary form as voltage levels between sending and receiving
circuits. The format of the signal on the line during transmission is
determined by the line code. Manchester code and AMI are examples of line codes
used for data transmission.